/*
*Author 		Gina Maya Purnama
*DateCreated	5 April 2011
*DateModified	6 April
*Version		1.1
*/

package jtk.project4.fleet.field;

import nl.coderight.jazz.form.FormLayout;
import nl.coderight.jazz.form.FormLayout.Resize;
import nl.coderight.jazz.form.control.CalendarControl;
import nl.coderight.jazz.form.control.GroupControl;
import nl.coderight.jazz.form.field.ComboField;
import nl.coderight.jazz.form.field.NumberField;
import nl.coderight.jazz.form.field.SelectField;
import nl.coderight.jazz.form.field.SpinnerField;
import nl.coderight.jazz.form.field.TextField;

public class GeneralInformationAccidentField extends GroupControl{
	private ComboField<String> equipmentField;
	private ComboField<String> driverField;
	private ComboField<String> accidentTypeField;
	private TextField claimField;
	private NumberField unitsInvolvedField;
	private CalendarControl dateField;
	private NumberField injuriesField;
	private SpinnerField timeField;
	private NumberField damageCostField;
	private NumberField mileageField;
	private NumberField otherCostField;
	private ComboField<String> costCenterField;
	
	public GeneralInformationAccidentField(String bindID){
		setTitle("General Information");
		setBindID(bindID);
		createFields();
		createLayout();
		
	}

	private void createFields() {
		// TODO Auto-generated method stub
		equipmentField = new ComboField<String>("accidentEvent", "equipment");
		driverField = new ComboField<String> ("accidentEvent","driver");
		accidentTypeField = new ComboField<String>("accidentEvent","accidentType");
		costCenterField = new ComboField<String>("accidentEvent","acostCenter");
		
		timeField = new SpinnerField<String>("accidentEvent", "time");
		
		dateField = new CalendarControl ("Calender",15);
		
		claimField = new TextField("claim", 15);
		claimField.setRequired(true);
		
		unitsInvolvedField = new NumberField("unitsInvolved", 15);
		injuriesField = new NumberField("injuries", 15);
		damageCostField = new NumberField("damageCost", 15);
		mileageField = new NumberField("mileage", 15);
		otherCostField = new NumberField("otherCost", 15);
		
	}
	
	private void createLayout() {
		// TODO Auto-generated method stub
		setLayout(new FormLayout())

		.addLabel("label.equipment")		.addField(equipmentField,Resize.HORIZONTAL)
		.addRow()
		.addLabel("label.driver")			.addField(driverField, Resize.HORIZONTAL)
		.addRow()
		.addLabel("label.accidentType")		.addField(accidentTypeField, Resize.HORIZONTAL)
		.addRow()
		.addLabel("label.claim#")			.addField(claimField)
		.addLabel("label.unitsInvolved")	.addField(unitsInvolvedField)
		.addRow()
		.addLabel("label.date")				.addField(dateField)
		.addLabel("label.injuries")			.addField(injuriesField)
		.addRow()
		.addLabel("label.time")			 	.addField(timeField)
		.addLabel("label.damageCost")		.addField(damageCostField)
		.addRow()
		.addLabel("label.mileage")			.addField(mileageField)
		.addLabel("label.otherCost")		.addField(otherCostField)
		.addRow()
		.addLabel("label.costCenter")		.addField(costCenterField,Resize.HORIZONTAL)
		;	
	}
	
}
